import request from '@/utils/request'

const order = {

  submitOrderAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/submit/' + orderNo,
      method: 'put'
    })
  },
  cancelOrderAPI: function (params) {
    return request({
      url: '/eims/sales/order/cancel/' + params.orderNo,
      method: 'put',
      data: params
    })
  },
  completedOrderAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/completed/' + orderNo,
      method: 'put'
    })
  },
  passOrderAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/pass/' + orderNo,
      method: 'put'
    })
  },
  rejectOrderAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/reject/' + orderNo,
      method: 'put'
    })
  },
  getSalesOrderAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/detail/' + orderNo,
      method: 'get'
    })
  },
  getSalesOrderListAPI: function (params) {
    return request({
      url: '/eims/sales/order/list',
      method: 'post',
      data: params
    })
  },
  getOrderProductListAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/detail/list/' + orderNo,
      method: 'get'
    })
  },
  getOrderServiceListAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/service/list/' + orderNo,
      method: 'get'
    })
  },
  getOrderProductStockListAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/detail/stock/' + orderNo,
      method: 'get'
    })
  },
  getSalesOrderProductLockedListAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/stockLocked/list/' + orderNo,
      method: 'get'
    })
  },
  getOrderStockRecordListAPI: function (orderNo) {
    return request({
      url: '/eims/sales/order/detail/stockRecord/list/' + orderNo,
      method: 'get'
    })
  },
  orderProductPreparationStockAPI: function (param) {
    return request({
      url: '/eims/sales/order/detail/preparation/' + param.orderNo + '/' + param.orderDetailNo,
      method: 'put'
    })
  },
  saveOrderInfoAPI: function (orderInfo) {
    return request({
      url: '/eims/sales/order/save',
      method: 'post',
      data: orderInfo
    })
  },
  updateOrderInfoAPI: function (orderInfo) {
    return request({
      url: '/eims/sales/order/update/' + orderInfo.orderNo,
      method: 'put',
      data: orderInfo
    })
  },
  saveSalesOrderDetailAPI: function (orderDetailInfo) {
    return request({
      url: '/eims/sales/order/detail/save',
      method: 'post',
      data: orderDetailInfo
    })
  },
  deleteSalesOrderDetailAPI: function (params) {
    return request({
      url: '/eims/sales/order/detail/delete/' + params.orderNo + '/' + params.orderDetailNo,
      method: 'delete'
    })
  },
  deleteOrderServiceAPI: function (params) {
    return request({
      url: '/eims/sales/order/service/delete/' + params.orderNo + '/' + params.serviceCode,
      method: 'delete'
    })
  },
  saveOrderServiceAPI: function (params) {
    return request({
      url: '/eims/sales/order/service/save',
      method: 'post',
      data: params
    })
  }
}

export default order
